<#include "common/main.html">
<#macro bodyId>priviledge-list</#macro>
<#macro content>

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main ty-common-page">
    <h1 class="page-header">功能角色管理
        <div class="btns">
            <a class="btn btn-success" href="${rc.contextPath}/priviledge/gotoAddOrUpdate">新增功能角色</a>
        </div>
    </h1>
    <div class="table-responsive">
        <table class="table table-striped ty-rights-mg-table">
            <thead>
            <tr>
                <th class="role-name">角色名称</th>
                <th class="active-rule">菜单权限 / 操作权限</th>
                <th class="update-time" style="width:100px;">操作时间</th>
                <th class="edit-active">操作</th>
            </tr>
            </thead>
            <tbody>
            <#list roleList as role>
            <tr data-roleId="${role.id}">
                <td>${role.name}</td>
                <td>
                <#assign rootPriviledgeMap = (priviledgeMap.get(role.id)!)/>
                <#if rootPriviledgeMap??&&(rootPriviledgeMap?size>0)>
                <#assign rootMenuActionList = (rootPriviledgeMap.get('rootMenuActionList'))/>
                <#if rootMenuActionList??&&(rootMenuActionList!='')>
                    <#list rootMenuActionList as rootMenuAction>
                    	<#if rootMenuAction??>
                            <div class="menu-active-rule" data-menuId="${rootMenuAction.id}">
                                <h3 class="menu-name">${rootMenuAction.name}</h3>
                                <#assign subMenuActionList = priviledgeMap.get(role.id).get('subMenuActionMap').get(rootMenuAction.id)/>
                                <#if subMenuActionList??&&(subMenuActionList!='')>
                                	<#list subMenuActionList as subMenuAction>
		                                <div class="sub-menu" data-subMenuId="${subMenuAction.id}">
		                                    <h4 class="sub-menu-name">${subMenuAction.name}</h4>
		                                    <#assign leafPriviledgeMap = (priviledgeMap.get(role.id).get('leafActionMap')!)/>
                                            <#if leafPriviledgeMap??&&(leafPriviledgeMap?size>0)>
		                                    <#assign leafMenuActionList = leafPriviledgeMap.get(subMenuAction.id)/>
		                                    <#if leafMenuActionList??&&leafMenuActionList!=''>
			                                    <div class="actives">
			                                    	<#list leafMenuActionList as action>
				                                        <em data-activeId="${action.id}">${action.name}</em>
			                                        </#list>
			                                    </div>
			                                </#if>
			                                </#if>
		                                </div>
	                                </#list>
                                </#if>
                            </div>
                        </#if>
                    </#list>
            	</#if>
            	</#if>
                </td>
                <td>${role.updateTime?number?number_to_datetime?string("yyyy-MM-dd HH:mm")}</td>
                <td><a href="${rc.contextPath}/priviledge/gotoAddOrUpdate?roleId=${role.id}" class="btn btn-primary">修改</a></td>
            </tr>
            </#list>
            </tbody>
        </table>
    </div>
</div>

<script>
    var config = {}
</script>
</#macro>